package main

import (
	"fmt"
	"gitee.com/kinwyb/appTools/appTool/code-generate/example/rpcx/exampleRpc"
	"gitee.com/kinwyb/appTools/examples/src/assembly"
	"gitee.com/kinwyb/godb"
	"github.com/smallnest/rpcx/client"
)

func main() {
	d, _ := client.NewPeer2PeerDiscovery("tcp@localhost:8798", "")
	exampleRpc.RpcxClients(d, client.Failtry, client.RandomSelect, client.DefaultOption)
	defer exampleRpc.RpcxClose()
	ret, err := exampleRpc.RpcHealthCheck()
	if err != nil {
		fmt.Printf("错误：%s\n", err.Error())
		return
	}
	if ret {
		fmt.Printf("健康状态正常\n")
	}
	//fmt.Printf("5+6 = %d\n", exampleRpc.ArithSev.Mul(5, 6))
	fmt.Printf("7+8 = %d\n", exampleRpc.ArithMulFun(7, 8))
	exampleRpc.NoResult()
	pg := &godb.PageObj{}
	exampleRpc.PageTest(pg, assembly.NewContext("e"))
	fmt.Printf("Funcs.PageTest : %d\n", pg.Total)
	pg = &godb.PageObj{}
	result := exampleRpc.ArithSev.PageTest(12, pg, assembly.NewContext("d"))
	fmt.Printf("Arith.PageTest : %d , %v\n", pg.Total, result)
	pg = &godb.PageObj{}
	exampleRpc.ArithSev.PageTestNoResult(12, pg, assembly.NewContext("d"))
	fmt.Printf("Arith.PageTest : %d\n", pg.Total)
	exampleRpc.GoFunc()
	fmt.Printf("Funcs.GoFunc \n")
}
